<extend name="Public/layout"/>
<block name="head">
<link rel="stylesheet" href="__PUBLIC__css/infor.css">
<style type="text/css">
.footer{
  display: none;
}
</style>
</block>
   <block name="main">
      <div class="container">
        <div class="form">
          <div class="name">
            <input id="name" type="text" placeholder="请输入您的真实姓名"/>
          </div>
          
          <div class="id-card" <if condition="$user eq 1"> style="display: none" </if> >
            <input id="id-card" type="text" placeholder="请输入您的身份证号码"/>
          </div>
        </div>
        <div class="btn">
          <p>下一步</p>
        </div>
      </div>
</block>
<block name="js">
      <script type="text/javascript">
      var id_card = "{$user}";
      $('.btn').click(function(){
        var name = $('#name').val();
        var idCard = $('#id-card').val();
        if(!name){
            layer.open({
              content: '请输入您的真实姓名！'
              ,skin: 'msg'
              ,time: 2 //2秒后自动关闭
            });return;
        }
        if(!id_card) {
          if(!idCard){
            layer.open({
                content: '请输入您的身份证号码！'
                ,skin: 'msg'
                ,time: 2 //2秒后自动关闭
              });return;
          }
        }
        if(name || idCard){
          var pattern = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
          if(!id_card) {
            if(!pattern.test(idCard)){
              layer.open({
                content: '请输入正确的身份证号码！'
                ,skin: 'msg'
                ,time: 2 //2秒后自动关闭
              });
            }
          } else {
            $.post('{:U("Recommend/factions_idcard")}',{realname:name,idcard:idCard},function(res) {
              if(res.err==0) {
                location.href = "/Home/Recommend/factions_thunder";
              }
            });
          }
        }
      })
      </script>
</block>